import request from '@/utils/request'

/**
 * 员工接口
 */
// 登录
export const login = (data) => {
  return request({
    url: '/employee/login',
    method: 'post',
    data
  })
}

// 退出登录
export const logout = () => {
  return request({
    url: '/employee/logout',
    method: 'post'
  })
}

// 修改密码
export const changePassword = (obj) => {
  return request({
    url: '/employee/editPassword',
    method: 'put',
    data: obj
  })
}

// 查询员工列表
export const getEmployee = (params) => {
  return request.get('/employee/page', {
    params: params
  })
}

// 启用、禁用员工账号
export const changeStatus = (status, id) => {
  return request({
    url: '/employee/status/' + status,
    method: 'post',
    params: {
      id
    }
  })
}

// 添加员工
export const addEmployee = (data) => {
  return request({
    url: '/employee',
    method: 'post',
    data: data
  })
}

// 根据ID查询员工
export const getIdEmployee = (id) => {
  return request.get('/employee/' + id, {})
}

// 修改员工信息
export const editEmployee = (data) => {
  return request({
    url: '/employee',
    method: 'put',
    data: data
  })
}
